﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class _Default : System.Web.UI.Page
{
    int _inum = 0;
    string inum
    {
        get { return (++_inum).ToString() + ". "; }
    }
    protected void Page_PreInit(object sender, EventArgs e)
    {
        TraceWarn("Page_PreInit");
    }
    protected void Page_Init(object sender, EventArgs e)
    {
        TraceWarn("Page_Init");
    }
    protected void Page_InitComplete(object sender, EventArgs e)
    {
        TraceWarn("Page_InitComplete");
    }
    protected void Page_PreLoad(object sender, EventArgs e)
    {
        TraceWarn("Page_PreLoad");
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        TraceWarn("Page_Load");
    }
    protected void Page_LoadComplete(object sender, EventArgs e)
    {
        TraceWarn("Page_LoadComplete");
    }
    protected void Page_PreRender(object sender, EventArgs e)
    {
        uxConnStr.Text = System.Web.Configuration.WebConfigurationManager.ConnectionStrings["MasertDB"].ConnectionString;
        TraceWarn("Page_PreRender");
    }
    protected void Page_PreRenderComplete(object sender, EventArgs e)
    {
        TraceWarn("Page_PreRenderComplete");
    }
    protected void Page_SaveStateComplete(object sender, EventArgs e)
    {
        TraceWarn("Page_SaveStateComplete");
    }
    protected void Page_Unload(object sender, EventArgs e)
    {
        // No message can be shown at this stage
    }
    protected void TextBox1_TextChanged(object sender, EventArgs e)
    {
        TraceWrite("TextBox1_TextChanged");
    }
    protected void TextBox1_DataBinding(object sender, EventArgs e)
    {
        TraceWrite("TextBox1_DataBinding");
    }
    protected void TextBox1_Disposed(object sender, EventArgs e)
    {
        TraceWrite("TextBox1_Disposed");
    }
    protected void TextBox1_Init(object sender, EventArgs e)
    {
        TraceWrite("TextBox1_Init");
    }
    protected void TextBox1_Load(object sender, EventArgs e)
    {
        TraceWrite("TextBox1_Load");
    }
    protected void TextBox1_PreRender(object sender, EventArgs e)
    {
        TraceWrite("TextBox1_PreRender");
    }
    protected void TextBox1_Unload(object sender, EventArgs e)
    {
        TraceWrite("TextBox1_Unload");
    }
    protected void Label1_DataBinding(object sender, EventArgs e)
    {
        TraceWrite("Label1_DataBinding");
    }
    protected void Label1_Disposed(object sender, EventArgs e)
    {
        TraceWrite("Label1_Disposed");
    }
    protected void Label1_Init(object sender, EventArgs e)
    {
        TraceWrite("Label1_Init");
    }
    protected void Label1_Load(object sender, EventArgs e)
    {
        TraceWrite("Label1_Load");
    }
    protected void Label1_PreRender(object sender, EventArgs e)
    {
        TraceWrite("Label1_PreRender");
    }
    protected void Label1_Unload(object sender, EventArgs e)
    {
        TraceWrite("Label1_Unload");
    }
    protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
    {
        TraceWrite("DropDownList1_SelectedIndexChanged");
    }
    protected void DropDownList1_TextChanged(object sender, EventArgs e)
    {
        TraceWrite("DropDownList1_TextChanged");
    }
    protected void DropDownList1_DataBinding(object sender, EventArgs e)
    {
        TraceWrite("DropDownList1_DataBinding");
    }
    protected void DropDownList1_DataBound(object sender, EventArgs e)
    {
        TraceWrite("DropDownList1_DataBound");
    }
    protected void DropDownList1_Disposed(object sender, EventArgs e)
    {
        TraceWrite("DropDownList1_Disposed");
    }
    protected void DropDownList1_Init(object sender, EventArgs e)
    {
        TraceWrite("DropDownList1_Init");
    }
    protected void DropDownList1_Load(object sender, EventArgs e)
    {
        TraceWrite("DropDownList1_Load");
    }
    protected void DropDownList1_PreRender(object sender, EventArgs e)
    {
        TraceWrite("DropDownList1_PreRender");
    }
    protected void DropDownList1_Unload(object sender, EventArgs e)
    {
        TraceWrite("DropDownList1_Unload");
    }
    protected void TraceWrite(string message)
    {
        Trace.Write(inum + message);
    }
    protected void TraceWarn(string message)
    {
        Trace.Warn(inum + message);
    }
    protected void Button2_Click(object sender, EventArgs e)
    {
        System.Configuration.Configuration config =
            System.Web.Configuration.WebConfigurationManager
            .OpenWebConfiguration("/helper");

        if (config.HasFile)
        {
            config.ConnectionStrings.ConnectionStrings["MasertDB"]
                .ConnectionString = uxConnStr.Text;
            config.Save();
        }

        Session["CONNSTR"] = System.Web.Configuration.WebConfigurationManager.
            ConnectionStrings["MasertDB"].ConnectionString;
    }
    protected void Button3_Click(object sender, EventArgs e)
    {
        Response.Write(@"<script language=\""javascript\"">windows.open( '" + redmineURL.Text + "' );</script>");

        //Response.Write("<script>windows.open( '" + redmineURL.Text + "' , _blank,'Redmine' , 'fullscreen=3,height=100, width=400, top=0, left=0, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, status=no');</script>");
    }
}